/* GUI CONVERTED from ecreviq.p (converter v1.76) Tue Dec 31 10:45:23 2002 */
/* ecreviq.p - PCO revision level by part inquiry                           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/* $Revision: 1.7.1.8 $                                                         */
/*V8:ConvertMode=Report                                                     */
/* REVISION: 7.4      LAST EDIT:     12/30/93   BY: QZL *H013*              */
/* REVISION: 8.6      LAST EDIT:     06/10/96   BY: Mariya Kutwal *K00C*    */
/* REVISION: 8.6      LAST MODIFIED: 11/14/97   BY: *J266* Thomas Fernandes */
/* REVISION: 8.6      LAST MODIFIED: 02/12/98   BY: *K1H1* Beena Mol        */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane        */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0KW* Jacolyn Neder    */
/* REVISION: 9.1      LAST MODIFIED: 08/24/00   BY: *N0MZ* Rajinder Kamra   */
/* REVISION: 9.1      LAST MODIFIED: 03/12/01   BY: *M120* Vihang Talwalkar */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.7.1.8 $    BY: Katie Hilbert         DATE: 12/27/02  ECO: *P0L8*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* ecd9_det table was replaced by rsu_mstr and rsud_det tables */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define shared variable global_recid as recid.

define variable parent    like pt_part no-undo.
define variable desc1     like pt_desc1.
define variable ecmnbr    like ecm_nbr.
define variable ecmid     like wo_lot.
define variable dbase     like si_db.
define variable ecmstatus like ecm_status format "x(8)".
define variable reject    like mfc_logical.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
parent     colon 13
   desc1      colon 35 no-label
with frame a width 80 attr-space side-labels NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   ecmnbr
   ecmid
   dbase
   ecm_title     format "x(25)"
   ecmstatus
   ecd_new_rev   column-label "PCC Rev"
   ecm_eff_date
with STREAM-IO /*GUI*/  frame b down width 80.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

view frame a.
view frame b.

{wbrp01.i}

loop-a:
repeat with frame a:

   if c-application-mode <> 'web' then
      update parent
   editing:

      if frame-field = "parent" then do:
         /* FIND NEXT/PREVIOUS RECORD */

         {mfnp.i pt_mstr
            parent
            pt_part
            parent
            pt_part
            pt_part}

         if recno <> ? then do:

            parent = pt_part.
            display
               parent
               pt_desc1 @ desc1
            with frame a.
            recno = ?.

         end.
      end.
   end.

   {wbrp06.i &command = update &fields = "  parent" &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data'))
   then do:

      find pt_mstr use-index pt_part
         where pt_part = parent no-lock no-error.

      if available pt_mstr then
         display
            parent
            desc1
         with frame a.

   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.

   clear frame b all no-pause.

   /* ECM_MSTR AND ECD_DET WERE ACCESSED WITHOUT REGARD TO THE USER'S
    * INPUT. NOW ECD_DET IS FILTERED OUT ACCORDING TO THE USER'S INPUT
    * THUS IMPROVING THE PERFORMANCE.
    */

   for each ecd_det  no-lock where ecd_part = parent,
         each ecm_mstr no-lock where ecm_nbr  = ecd_nbr
         break by ecm_eff_date with frame b:

      run get_ecm_status_label
         (buffer ecm_mstr, input 8, output ecmstatus).

      display
         substring(ecm_nbr,1,8)  @ ecmnbr
         substring(ecm_nbr,9,8)  @ ecmid
         substring(ecm_nbr,17,8) @ dbase
         ecm_title
         ecmstatus
         ecd_new_rev
         ecm_eff_date WITH STREAM-IO /*GUI*/ .
      down.

   end. /* for each ecd_det */

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

end.  /* End of loop-a */

{wbrp04.i &frame-spec = a}

{ecstatus.i}
